<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title>骨医快线</title>
	<link href="../../css/mui.plus.css" rel="stylesheet" />				
	<style>
		.oe-login input {
			border-bottom: 1px solid #ccc;
			background-color: #fff;
		}
		button.disabled {
		    border: 1px solid #ccc!important;
		    color: #999!important;
		    background: #fff!important;
		}
	</style>
</head>
<body>
	<span class="mui-action-back" style="position: absolute;right: 20px;top: 20px;color: #999;">关闭</span>
	<div class="mui-content oe-login">
		<form class="mui-input-group">
			<div class="mui-input-row"  style="margin-bottom: 15px;">
				<input id="pwdInp" type="password" class="mui-input-clear" placeholder="设置密码">
			</div>
			<div class="mui-input-row"  style="margin-bottom: 15px;">
				<input id="pwdConInp" type="password" class="mui-input-clear" placeholder="确认密码">
			</div>
				
			<button id="regBtn" type="button" class="mui-btn mui-btn-primary oe-btn-block" onclick="return false;">登&nbsp;&nbsp;&nbsp;陆</button>&nbsp;&nbsp;
		</form>
	</div>
	
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/app.js"></script>
    <script src="../../js/lib/md5.js"></script>
	<script type="text/javascript">
		(function($,doc){
	    	var login = app.login;
	    	var updateInfo = {};//注册信息
	    	
			$.plusReady(function(){
	  			plus.screen.lockOrientation('portrait-primary');
	  			
	  			var self = plus.webview.currentWebview();
				updateInfo.dr_mobile = self.account;
				updateInfo.dr_id = self.drId;
				
				var pwdInp = doc.getElementById('pwdInp');
				var pwdConInp = doc.getElementById('pwdConInp');
				var regBtn = doc.getElementById('regBtn');
				
				$.preload({
					id: 'user-info',
	  				url:'user-info.html'
				});
				
				regBtn.addEventListener('tap',function(event){
					updateInfo.dr_psw = hex_md5(pwdInp.value);
					var pwdConfirm = hex_md5(pwdInp.value);
					if (pwdConfirm != updateInfo.dr_psw) {
						plus.nativeUI.toast('两次输入的密码不一致');
						return;
					}
					
					app.net.post('doctors/update.json', updateInfo, function(data){
						if(data && data.code === '100'){
							app.bc();
							$.openWindow({
								id: 'main'
							})
							$.toast('登录成功');
						}else {
							$.toast('更新失败，请检查您的网络')
						}
					})
				})
			});
	    }(mui,document));
	</script>
</body>
</html>